import {
	getAllDiction
} from '@/services/dictionary';


export default {
  namespace: 'dictionary',
  state: { },
  effects: {
    // 初始化字典
    *fetchDic({ payload, callback }, { call }) {
      // 调用字典查询接口
      const { list: data } = yield call(getAllDiction, payload);
      // if (null == localStorage.getItem('_DICTIONARY')){
        // localStorage.setItem('_DICTIONARY', JSON.stringify(data))
      // }
    },
  },
  subscriptions: {
    setup({dispatch, history}) {
      return history.listen(({}) => {
          dispatch({type: 'fetchDic'})
      });
    },
  },
};
